package com.feng.annotation.controller;

import com.feng.annotation.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.sql.DataSource;
import java.sql.SQLException;

/**
 * @author Lee
 * @date 2019/3/6
 */
@Controller
public class UserController{


    @Autowired
    private DataSource dataSource;

    @Autowired
    private UserService userService;

    @RequestMapping("/helloUser")
    @ResponseBody
    public String helloUser() {
        return userService.sayHello();
    }

    @RequestMapping("/success")
    public String success() throws SQLException {
        System.out.println(dataSource.getConnection());
        return "success";
    }

}
